package day27;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Date;

public class Client1 {
    public static void main(String[] args) throws IOException {
        //1.创建客户端对象
        Socket client=new Socket("127.0.0.1",999);
        //2.创建输入输出流
        BufferedReader br=new BufferedReader(new InputStreamReader(client.getInputStream()));
        OutputStream os=client.getOutputStream();
        String result=br.readLine();
        System.out.println("服务端:"+result);
        os.write("你好，我是客户端\n".getBytes());

    }
}

